<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/cloudiary.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Cloudiary</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<script type="text/javascript" src="Js/jquery.js"></script>
<script type="text/javascript" src="Js/slider.js"></script>
<script type="text/javascript" src="Js/jquery-1.3.1.min.js"></script>	

<script type="text/javascript" src="Js/login.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js?ver=1.4.2"></script>
<!-- InstanceEndEditable -->
<link href="CSS/css.css" rel="stylesheet" type="text/css" />
</head>
<?php 
include('userlock.php');

if($_SERVER["REQUEST_METHOD"] == "POST")
{
	if(isset($_POST['editID'])){
	$_SESSION['editID'] = $_POST['editID'];
	$editid = $_SESSION['editID'];
	}else{
	if(isset($_SESSION['editID'])){
    $editid = $_SESSION['editID'];}
	if($_POST['topic'] && $_POST['post']){
	$mytopic=addslashes($_POST['topic']); 
	$mypost=addslashes($_POST['post']);
	$myprivacy=addslashes($_POST['privacy_type']);
	$hour= date("H") + 6;
	if($hour > 23)
	{
	$hour = $hour - 24;
	}
	$writedate = date("Y-m-d $hour:i:s");
	
	$sql="UPDATE post SET post='$mypost', post_topic='$mytopic', post_edit_date='$writedate', privacy_type='$myprivacy' WHERE post_id = '$editid'";
	
	
	mysql_query($sql);
	header('Location: ViewPosts.php');
	}
	}
	
	
	
}

$sql = "SELECT * FROM post Where post_id = '$editid'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);

?>
<body>
<div id="container">
<div id="wrapper">

<div id="header">
<!-- InstanceBeginEditable name="header" -->
<div class="welcome">
<?php include('welcomeuser.php');?>
</div>
<!-- InstanceEndEditable -->

<img src="Assets/cloud diary low-01(trans).png" alt="CloudDiary" width="75" height="45" style="padding:5px 10px;" /> <br />
</div>

<div id="main">
<!-- InstanceBeginEditable name="main" -->
<ul class="dropdown">
<li><a href="Home.php" class="linkStraight">Home &nbsp; &nbsp;</a></li>
<li><a href="#" class="linkDown" id="classification">Classifications &nbsp; &nbsp;</a>
	<ul class="sub_menu" id="menu1">
    <li> <a href="PublicClassification.php"> Public &nbsp; </a> </li>
    <li> <a href="FriendClassification.php"> Friend &nbsp; </a> </li>
    </ul>
</li>
<li><a href="#" class="linkDown" id="friends">Friends &nbsp; &nbsp;</a>
	<ul class="sub_menu" id="menu2">
    <li> <a href="Friends.php"> Search Friends &nbsp; </a> </li>
    <li> <a href="CurrentFriends.php"> Current Friends &nbsp; </a> </li>
    <li> <a href="Send.php"> Sending Request &nbsp; </a> </li>
    <li> <a href="Receive.php"> Pending Request &nbsp; </a> </li>
    </ul>
</li>
<li><a href="#" class="linkDown" id="posts">Posts &nbsp; &nbsp;</a>
	<ul class="sub_menu" id="menu3">
    <li> <a href="NewPost.php"> New Post &nbsp; </a> </li>
    <li> <a href="ViewPosts.php">  View All Posts &nbsp; </a> </li>
    </ul>
</li>
<li><a href="Privacy.php" class="linkStraight">Privacy Settings &nbsp; &nbsp;</a></li>
</ul>

<div id="content">
<div style="margin-left:auto; /* [disabled]margin-right:auto; */">
<form method="post">
<p align="left" style="font-size:16px;font-weight:bold"> Topic: <input type="text" name="topic" value="<?php echo $row["post_topic"]; ?>" size="40"/> </p>
Post: <br />

<textarea cols="100%" rows="15" name="post"> <?php echo $row["post"]; ?> </textarea>
</p> 
<br />
<p align="right" style="padding-right:350px">
<input type="image" src="Assets/buttonUpdate.png" value="Update" />
</form>
</p>
</div>
</div>
<!-- InstanceEndEditable -->
</div>

</div>
</div>

<div id="footer">
<p align="center"> &copy; &nbsp; 2012 CloudDiary </p>
</div>
</body>
<!-- InstanceEnd --></html>
